<script>
import {mapState} from "vuex";
import common from "@/api/common";
import globalConfig from "@/utils/config.js";

export default {
  async onLaunch() {
    console.log("App Launch");
    await this.getList();
  },
  computed: {
    ...mapState(["tabbarPages"])
  },
  methods: {
    async getList() {
      const res = await common.getTabBar();
      const list = res.rows;
      const imageUrl = globalConfig.imageUrl;
      list.forEach((i) => {
        i.hitIconImage = imageUrl + i.hitIconImage;
        i.staticIconImage = imageUrl + i.staticIconImage;
      });
      wx.setStorageSync("tabbarPages", JSON.stringify(list));
      //  时间问题，所以直接设置调
      if (getApp().setTabBarList) {
        getApp().setTabBarList(list);
      }
      return Promise.resolve(list);
    }
  },

  mounted() {
  },
  onHide() {
  }
};
</script>

<style lang="scss">
@import "/wxcomponents/vant/common/index.wxss";
@import "/static/base.css";
@import "components/icon/iconfont.css";

/*每个页面公共css */
page {
  min-height: 100%;
  display: flex;
  font-size: 14px;
  background-color: #f5f5f5;
  padding-bottom: constant(safe-area-inset-bottom); /*兼容 IOS<11.2*/
  padding-bottom: env(safe-area-inset-bottom); /*兼容 IOS>11.2*/
}

/* #ifdef MP-BAIDU */
page {
  width: 100%;
  height: 100%;
  display: block;
}

swan-template {
  width: 100%;
  min-height: 100%;
  display: flex;
}

/* 原生组件模式下需要注意组件外部样式 */
custom-component {
  width: 100%;
  min-height: 100%;
  display: flex;
}

/* #endif */

/* #ifdef MP-ALIPAY */
page {
  min-height: 100vh;
}

/* #endif */

/* 原生组件模式下需要注意组件外部样式 */
.content {
  display: flex;
  flex: 1;
  flex-direction: column;
  background-color: #efeff4;
  padding: 10px;
}

.input-group {
  background-color: #ffffff;
  margin-top: 20px;
  position: relative;
}

.input-group::before {
  position: absolute;
  right: 0;
  top: 0;
  left: 0;
  height: 1px;
  content: "";
  -webkit-transform: scaleY(0.5);
  transform: scaleY(0.5);
  background-color: #c8c7cc;
}

.input-group::after {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 1px;
  content: "";
  -webkit-transform: scaleY(0.5);
  transform: scaleY(0.5);
  background-color: #c8c7cc;
}

.input-row {
  display: flex;
  flex-direction: row;
  position: relative;
  font-size: 18px;
  line-height: 40px;
}

.input-row .title {
  /* width: 100px; */
  padding-left: 15px;
}

.input-row.border::after {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 8px;
  height: 1px;
  content: "";
  -webkit-transform: scaleY(0.5);
  transform: scaleY(0.5);
  background-color: #c8c7cc;
}

.btn-row {
  margin-top: 25px;
  padding: 10px;
}

button.primary {
  background-color: #f0780e;
}

.custom-tab-place {
  width: 100%;
  height: 96 rpx;
}
</style>
